package com.okami.designpatterns.factory.factorymethod;

import com.okami.designpatterns.factory.CircularShape;
import com.okami.designpatterns.factory.NoProductException;
import com.okami.designpatterns.factory.Shape;
import com.okami.designpatterns.factory.SquareShape;

/**
 * @description: 生产红色图形
 * @author: TanJingyu
 * @create: 2020-12-09 14:31
 **/
class RedShapeStore implements ShapeStore {

    @Override
    public Shape craeteShape(String shapeStr) throws NoProductException {
        if ("circular".equalsIgnoreCase(shapeStr)) {
            return new CircularShape("这是红色圆形，哈哈！");
        }else if ("square".equalsIgnoreCase(shapeStr)) {
            return new SquareShape("这是红色正方形，哈哈！");
        }else {
            throw new NoProductException("抱歉，生产不了" + shapeStr);
        }
    }
}
